package ab.mes.service.impl;

import ab.mes.entity.Staff;
import ab.mes.mapper.StaffMapper;
import ab.mes.service.StaffService;
import ab.mes.tools.PageParams;
import ab.mes.tools.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StaffServiceImpl implements StaffService {
    @Autowired
    private StaffMapper staffMapper;

    public Result getStaffByNumber(Integer number){
        Result result = new Result();
        result.getMap().put("staff",staffMapper.selectByNumber(number));
        return result;
    }

    //获取一页人员信息(工号、姓名、照片)
    public Result getStaff(){
        Result result = new Result();
        result.getMap().put("staff",staffMapper.selectStaff1());
        return result;
    }
    //新增人员信息
    public Result insertStaff(Staff staff) {
        Result result = new Result();
        result.getMap().put("staff",staffMapper.insertStaff(staff));
        return result;
    }
    //根据id删除人员信息
    public Result deleteStaff(Integer id_Of_Staff) {
        Result result = new Result();
        result.getMap().put("staff", staffMapper.deleteStaff(id_Of_Staff));
        return result;
    }
    //修改人员信息
    public Result editStaff(Staff staff){
        Result result = new Result();
        result.getMap().put("staff",staffMapper.editStaff(staff));
        return result;
    }
}
